@echo off
echo 开始构建生产环境...

echo 构建主应用...
cd ablaze-frontend-vite
call pnpm run build
echo 主应用构建完成!

cd ..

echo 构建管理后台...
cd ablaze-admin
call pnpm run build
echo 管理后台构建完成!

cd ..

echo 构建educoder预览器...
cd educoder
call pnpm run build
echo educoder预览器构建完成!

cd ..

echo 所有应用构建完成!
echo 主应用输出目录: ablaze-frontend-vite/dist
echo 管理后台输出目录: ablaze-admin/dist
echo educoder预览器输出目录: educoder/dist

echo 是否要部署到CDN? (Y/N)
set /p deploy=
if /i "%deploy%"=="Y" (
    echo 开始部署到CDN...
    
    echo 部署主应用...
    cd ablaze-frontend-vite
    call pnpm run deploy:cdn
    cd ..
    
    echo 部署管理后台...
    cd ablaze-admin
    call pnpm run deploy:cdn
    cd ..
    
    echo 部署educoder预览器...
    cd educoder
    call pnpm run deploy:cdn
    cd ..
    
    echo 所有应用已部署到CDN!
)

pause 